package com.wavehi.exce.lambda;

import com.wavehi.exce.functional_interface.MyInterface1;
import com.wavehi.exce.functional_interface.MyInterface2;
import org.junit.Test;

/**
 * @Author WaveHi
 * @Date 27/8/2021 上午 8:47
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Demonstrate the use of lambda expression.
 */
public class LambdaDemo1 {

    @Test
    public void testLambdaUse1() {
        //获取韩式接口的实例
        MyInterface1 mi = message -> System.out.println(message);
        //打印信息
        mi.print("Wow!");
    }

    @Test
    public void testLambdaUse2() {
        //获取函数式接口的实例
        MyInterface2 mi2 = (num1,num2) -> num1 + num2;
        //获取测试数据
        int num1 = 10;
        int num2 = 12;
        //测试结果
        System.out.println(mi2.add(num1, num2));
    }

    @Test
    public void testLambdaUse3() {
        //获取函数式接口的实例

        //获取测试数据
        //测试
    }

}
